﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace DAL_Class
{
    public class ChinhSua
    {
        NLLDataContext db;
        public string ConfigSite(MyConfig ent)
        {
            db = new NLLDataContext();
            string result = string.Empty;
            try
            {
                MyConfig cf = db.MyConfigs.Single(p => p.ID == ent.ID);
                cf.IconUrl = ent.IconUrl;
                cf.ButtonShare = ent.ButtonShare;
                cf.Title = ent.Title;
                cf.Footer = ent.Footer;
                cf.MetaTitle = ent.MetaTitle;
                cf.MetaDescription = ent.MetaDescription;
                cf.MetaKeywords = ent.MetaKeywords;
                cf.MetaRobots = ent.MetaRobots;
                cf.MetaAuthor = ent.MetaAuthor;

                db.SubmitChanges();

                return result = "Chỉnh sửa thành công";
            }
            catch (Exception ex)
            {
                throw ex;
            }
        }
        public IEnumerable<MyConfig> getConfig() {
            db = new NLLDataContext();
            IEnumerable<MyConfig> config = from c in db.MyConfigs 
                                      select c;
            return config;
        }
    }
}
